package cn.roderick.web.service;

import cn.roderick.web.dao.UserMapper;
import cn.roderick.web.model.User;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserMapper userDao;

    /**
     * insert new user
     */
    public void insertUser(){
        User user = new User();
//        user.setName("Trump");
//        user.setAge(29);
        userDao.insert(user);
    }

    /**
     * select all users
     * @return {@code List<User>}
     */
//    public List<User> selectAllUser(){
//        return userDao.selectList(new EntityWrapper<User>());
//    }

    /**
     * select user by id
     * @param id
     * @return
     */
    public User selectUserById(Integer id){
        return userDao.selectById(id);
    }
}
